<%@ page language="java" import="weaver.conn.RecordSet" pageEncoding="UTF-8" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.alibaba.fastjson.JSON" %>
<%@ page import="weaver.interfaces.cetc.action.util.WorkflowCreateHandler" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<script>
</script>
<%
    WorkflowCreateHandler handler = new WorkflowCreateHandler();
    RecordSet rs  = new RecordSet(  );
    JSONObject resultJson = new JSONObject(  );
    String id = Util.null2String( request.getParameter("id"));
    User user = HrmUserVarify.getUser( request, response );
    int userid = user.getUID();
    String creatorId = Util.null2String(userid);//创建人
    String workflowId = Util.null2String( request.getParameter("workflowId"));//流程ID
    String requestName = Util.null2String( request.getParameter("requestName"));//流程名称
    String IsNextFlow = "0";//是否提交下一节点
    String requestid = "";
    try {
        HashMap<String, String> requestMainMap = new HashMap<>();
        rs.executeQuery("select Lswldw_wldwbh,Lswldw_dwmc,Lswldw_customfield67,Lswldw_customfield68,Lswldw_customfield69," +
                "Lswldw_customfield70,Lswldw_customfield71,Lswldw_customfield72,Lswldw_customfield73," +
                "Lswldw_customfield74,Lswldw_customfield75,Lswldw_customfield76,Lswldw_customfield77," +
                "Lswldw_customfield78,Lswldw_customfield79,Lswldw_customfield80,sfdq from vw_cetc58_gys where id=?",id);
        if(rs.next()){
            String Lswldw_customfield67 = Util.null2String(rs.getString("Lswldw_customfield67"));
            String sfdq = Util.null2String(rs.getString("sfdq"));
            if("生产商（M）".equals( Lswldw_customfield67 ) && "0".equals( sfdq )){
                requestMainMap.put("gysbh",Util.null2String(rs.getString("Lswldw_wldwbh")));
                requestMainMap.put("gfdwmc",Util.null2String(rs.getString("Lswldw_dwmc")));
                requestMainMap.put("Lswldw_customfield68",Util.null2String(rs.getString("Lswldw_customfield68")));
                requestMainMap.put("Lswldw_customfield69",Util.null2String(rs.getString("Lswldw_customfield69")));
                requestMainMap.put("Lswldw_customfield70",Util.null2String(rs.getString("Lswldw_customfield70")));
                requestMainMap.put("Lswldw_customfield71",Util.null2String(rs.getString("Lswldw_customfield71")));
                requestMainMap.put("Lswldw_customfield72",Util.null2String(rs.getString("Lswldw_customfield72")));
                requestMainMap.put("Lswldw_customfield73",Util.null2String(rs.getString("Lswldw_customfield73")));
                requestMainMap.put("Lswldw_customfield74",Util.null2String(rs.getString("Lswldw_customfield74")));
                requestMainMap.put("Lswldw_customfield75",Util.null2String(rs.getString("Lswldw_customfield75")));
                requestMainMap.put("Lswldw_customfield76",Util.null2String(rs.getString("Lswldw_customfield76")));
                requestMainMap.put("Lswldw_customfield77",Util.null2String(rs.getString("Lswldw_customfield77")));
                requestMainMap.put("Lswldw_customfield78",Util.null2String(rs.getString("Lswldw_customfield78")));
                requestMainMap.put("Lswldw_customfield79",Util.null2String(rs.getString("Lswldw_customfield79")));
                requestMainMap.put("Lswldw_customfield80",Util.null2String(rs.getString("Lswldw_customfield80")));
                requestid = handler.WorkflowCreateByRequestMap( creatorId, workflowId, requestName, IsNextFlow, requestMainMap );
            }
            resultJson.put("requestid",requestid);
        }
        out.print(resultJson.toJSONString());
    }catch (Exception e){
        e.printStackTrace();
        out.print( "接口异常，请查看日志！！！" );
    }
%>
